Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class com.sun.java.swing.text.
JTextComponent.AccessibleJTextComponent

java.lang.Object
  |
  +--com.sun.java.accessibility.AccessibleContext
        |
        +--com.sun.java.swing.JComponent.AccessibleJComponent
              |
              +--com.sun.java.swing.text.JTextComponent.AccessibleJTextComponent
Subclasses:
JEditorPane.AccessibleJEditorPane, JTextArea.AccessibleJTextArea, JTextField.AccessibleJTextField

public class JTextComponent.AccessibleJTextComponent
extends JComponent.AccessibleJComponent
implements AccessibleText, CaretListener, DocumentListener
Accessibility implementation for JTextComponent.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
Serialized Form

Fields inherited from class com.sun.java.accessibility.AccessibleContext
ACCESSIBLE_CARET_PROPERTY, ACCESSIBLE_DESCRIPTION_PROPERTY, ACCESSIBLE_NAME_PROPERTY, ACCESSIBLE_SELECTION_PROPERTY, ACCESSIBLE_STATE_PROPERTY, ACCESSIBLE_TEXT_PROPERTY, ACCESSIBLE_VALUE_PROPERTY, ACCESSIBLE_VISIBLE_DATA_PROPERTY, accessibleDescription, accessibleName, accessibleParent
 
Constructor Summary
JTextComponent.AccessibleJTextComponent(JTextComponent this$0)
          Constructs an AccessibleJTextComponent.
 
Method Summary
void caretUpdate(CaretEvent e)
          Handles caret updates (fire appropriate property change event, which are AccessibleContext.
void changedUpdate(DocumentEvent e)
          Handles document remove (fire appropriate property change event, which is AccessibleContext.
AccessibleRole getAccessibleRole()
          Gets the role of this object.
AccessibleStateSet getAccessibleStateSet()
          Gets the state set of the JTextComponent.
AccessibleText getAccessibleText()
          Gets the AccessibleText interface associated with this object.
java.lang.String getAfterIndex(int part, int index)
          Returns the String after a given index.
java.lang.String getAtIndex(int part, int index)
          Returns the String at a given index.
java.lang.String getBeforeIndex(int part, int index)
          Returns the String before a given index.
int getCaretPosition()
          Returns the zero-based offset of the caret.
AttributeSet getCharacterAttribute(int i)
          Returns the AttributeSet for a given character (at a given index).
java.awt.Rectangle getCharacterBounds(int i)
          Determines the bounding box of the character at the given index into the string.
int getCharCount()
          Returns the number of characters (valid indicies)
int getIndexAtPoint(java.awt.Point p)
          Given a point in local coordinates, return the zero-based index of the character under that Point.
java.lang.String getSelectedText()
          Returns the portion of the text that is selected.
int getSelectionEnd()
          Returns the end offset within the selected text.
int getSelectionStart()
          Returns the start offset within the selected text.
void insertUpdate(DocumentEvent e)
          Handles document insert (fire appropriate property change event which is AccessibleContext.
void removeUpdate(DocumentEvent e)
          Handles document remove (fire appropriate property change event, which is AccessibleContext.
 
Methods inherited from class com.sun.java.swing.JComponent.AccessibleJComponent
addFocusListener, contains, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAccessibleComponent, getAccessibleDescription, getAccessibleIndexInParent, getAccessibleName, getAccessibleParent, getAccessibleRole, getAccessibleStateSet, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getLocale, getLocation, getLocationOnScreen, getSize, isEnabled, isFocusTraversable, isShowing, isVisible, removeFocusListener, requestFocus, setBackground, setBounds, setCursor, setEnabled, setFont, setForeground, setLocation, setSize, setVisible
 
Methods inherited from class com.sun.java.accessibility.AccessibleContext
addPropertyChangeListener, firePropertyChange, getAccessibleAction, getAccessibleChild, getAccessibleChildrenCount, getAccessibleComponent, getAccessibleDescription, getAccessibleIndexInParent, getAccessibleName, getAccessibleParent, getAccessibleRole, getAccessibleSelection, getAccessibleStateSet, getAccessibleText, getAccessibleValue, getLocale, removePropertyChangeListener, setAccessibleDescription, setAccessibleName, setAccessibleParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

JTextComponent.AccessibleJTextComponent

public JTextComponent.AccessibleJTextComponent(JTextComponent this$0)
Constructs an AccessibleJTextComponent. Adds a listener to track caret change.
Method Detail

caretUpdate

public void caretUpdate(CaretEvent e)
Handles caret updates (fire appropriate property change event, which are AccessibleContext.ACCESSIBLE_CARET_PROPERTY and AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY). This keeps track of the dot position internally. When the caret moves, the internal position is updated after firing the event.
Specified by:
caretUpdate in interface CaretListener
Parameters:
e - the CaretEvent

insertUpdate

public void insertUpdate(DocumentEvent e)
Handles document insert (fire appropriate property change event which is AccessibleContext.ACCESSIBLE_TEXT_PROPERTY). This tracks the dot via the event.
Specified by:
insertUpdate in interface DocumentListener
Parameters:
e - the DocumentEvent

removeUpdate

public void removeUpdate(DocumentEvent e)
Handles document remove (fire appropriate property change event, which is AccessibleContext.ACCESSIBLE_TEXT_PROPERTY). This tracks the dot via the event.
Specified by:
removeUpdate in interface DocumentListener
Parameters:
e - the DocumentEvent

changedUpdate

public void changedUpdate(DocumentEvent e)
Handles document remove (fire appropriate property change event, which is AccessibleContext.ACCESSIBLE_TEXT_PROPERTY). This tracks the dot via the event.
Specified by:
changedUpdate in interface DocumentListener
Parameters:
e - the DocumentEvent

getAccessibleStateSet

public AccessibleStateSet getAccessibleStateSet()
Gets the state set of the JTextComponent. The AccessibleStateSet of an object is composed of a set of unique AccessibleState's. A change in the AccessibleStateSet of an object will cause a PropertyChangeEvent to be fired for the AccessibleContext.ACCESSIBLE_STATE_PROPERTY property.
Returns:
an instance of AccessibleStateSet containing the current state set of the object
Overrides:
getAccessibleStateSet in class JComponent.AccessibleJComponent
See Also:
AccessibleStateSet, AccessibleState, addPropertyChangeListener

getAccessibleRole

public AccessibleRole getAccessibleRole()
Gets the role of this object.
Returns:
an instance of AccessibleRole describing the role of the object (AccessibleRole.TEXT)
Overrides:
getAccessibleRole in class JComponent.AccessibleJComponent
See Also:
AccessibleRole

getAccessibleText

public AccessibleText getAccessibleText()
Gets the AccessibleText interface associated with this object.
Returns:
an instance of AccessibleText
Overrides:
getAccessibleText in class AccessibleContext

getIndexAtPoint

public int getIndexAtPoint(java.awt.Point p)
Given a point in local coordinates, return the zero-based index of the character under that Point. If the point is invalid, this method returns -1.
Specified by:
getIndexAtPoint in interface AccessibleText
Parameters:
p - the Point in local coordinates
Returns:
the zero-based index of the character under Point p.

getCharacterBounds

public java.awt.Rectangle getCharacterBounds(int i)
Determines the bounding box of the character at the given index into the string. The bounds are returned in local coordinates. If the index is invalid a null rectangle is returned.
Specified by:
getCharacterBounds in interface AccessibleText
Parameters:
i - the index into the String >= 0
Returns:
the screen coordinates of the character's bounding box

getCharCount

public int getCharCount()
Returns the number of characters (valid indicies)
Specified by:
getCharCount in interface AccessibleText
Returns:
the number of characters >= 0

getCaretPosition

public int getCaretPosition()
Returns the zero-based offset of the caret. Note: The character to the right of the caret will have the same index value as the offset (the caret is between two characters).
Specified by:
getCaretPosition in interface AccessibleText
Returns:
the zero-based offset of the caret.

getCharacterAttribute

public AttributeSet getCharacterAttribute(int i)
Returns the AttributeSet for a given character (at a given index).
Specified by:
getCharacterAttribute in interface AccessibleText
Parameters:
i - the zero-based index into the text
Returns:
the AttributeSet of the character

getSelectionStart

public int getSelectionStart()
Returns the start offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same. Return 0 if the text is empty, or the caret position if no selection.
Specified by:
getSelectionStart in interface AccessibleText
Returns:
the index into the text of the start of the selection >= 0

getSelectionEnd

public int getSelectionEnd()
Returns the end offset within the selected text. If there is no selection, but there is a caret, the start and end offsets will be the same. Return 0 if the text is empty, or the caret position if no selection.
Specified by:
getSelectionEnd in interface AccessibleText
Returns:
the index into teh text of the end of the selection >= 0

getSelectedText

public java.lang.String getSelectedText()
Returns the portion of the text that is selected.
Specified by:
getSelectedText in interface AccessibleText
Returns:
the text, null if no selection

getAtIndex

public java.lang.String getAtIndex(int part,
                         int index)
Returns the String at a given index.
Specified by:
getAtIndex in interface AccessibleText
Parameters:
part - the AccessibleText.CHARACTER, AccessibleText.WORD, or AccessibleText.SENTENCE to retrieve
index - an index within the text >= 0
Returns:
the letter, word, or sentence, null for an invalid index or part

getAfterIndex

public java.lang.String getAfterIndex(int part,
                            int index)
Returns the String after a given index.
Specified by:
getAfterIndex in interface AccessibleText
Parameters:
part - the AccessibleText.CHARACTER, AccessibleText.WORD, or AccessibleText.SENTENCE to retrieve
index - an index within the text >= 0
Returns:
the letter, word, or sentence, null for an invalid index or part

getBeforeIndex

public java.lang.String getBeforeIndex(int part,
                             int index)
Returns the String before a given index.
Specified by:
getBeforeIndex in interface AccessibleText
Parameters:
part - the AccessibleText.CHARACTER, AccessibleText.WORD, or AccessibleText.SENTENCE to retrieve
index - an index within the text >= 0
Returns:
the letter, word, or sentence, null for an invalid index or part

Overview | Package | Class | Tree | Deprecated | Index | Help Java Platform
1.1.7
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Submit a bug or feature
Submit comments/suggestions about javadoc
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.